package net.sxnic.jhitem.itemannex.action;

import java.io.File;

import net.sxnic.item.ItemActionSupport;
import net.sxnic.jhitem.itemannex.ItemAnnex;
import net.sxnic.jhitem.itemannex.ItemAnnexManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description:  [一句话描述该类的功能]
 * @Author [姓名] [联系方式]
 * @CreateDate:
 * @UpdateDate:   
 * @Version 1.0
 */
 public class Download extends ItemActionSupport{
	private static final long serialVersionUID = 1L;

	private static Logger logger = LoggerFactory.getLogger(Download.class);
	
	@Autowired
	ItemAnnexManager itemAnnexManager;
	private String annexId;
	
	public String execute() throws Exception {
		//获取附件实体
		ItemAnnex itemAnnex = itemAnnexManager.get(annexId);
		//获取文件
		File file = new File(itemAnnex.getFilePath()+itemAnnex.getAttachName());
		//获取文件名称
		String fileName = itemAnnex.getFileName();
		
		//return this.writeFileCommon(file, fileName, false);
		return "";
	}

	public String getAnnexId() {
		return annexId;
	}

	public void setAnnexId(String annexId) {
		this.annexId = annexId;
	}

}
